<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../libs/animate.css">
    <script src="../libs/vue.js"></script>
    <style>
        .imgPic{
            width: 100px;
            height: 100px;
            border-radius: 50%;
            transition: all 1s ;
        }
        /* 无name */
        .v-enter{
            opacity: 0;
            transform: scale(0);
        }
        .v-enter-to{
            opacity: 1;
            transform: scale(1);
        }
        .v-leave{
            opacity: 1;
            transform: scale(1);
        }
        .v-leave-to{
            opacity: 0;
            transform: scale(0);
        }
        /* 有name */
        .fade-enter-active{
            animation: fadeIn 1s;
        }
        .fade-leave-active{
            animation: fadeOut 1s;
        }
    </style>
</head>
<body>
    <div id="app">
        <transition>
            <img :src="src" v-if="show" class="imgPic">
        </transition>
        <button @click="show=!show">切换</button>

        <transition name="fade" appear  appear-active-class="fadeIn">
            <img :src="src" v-if="show1" class="imgPic">
        </transition>
        <button @click="show1=!show1">切换</button>
    </div>
    
    <script>
        const vm = new Vue({
            data:{
                src:'https://dss2.bdstatic.com/5bVYsj_p_tVS5dKfpU_Y_D3/res/r/image/2022-10-7/banner.png',
                show:true,
                show1:true
            }
        }).$mount('#app');
    </script>
</body>
</html>